/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package db.entities;

import gui.components.basic.annotations.GuiParam;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

/**
 *
 * @author Luca
 */
@Entity
public class StarSystem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @GuiParam(label = "System Name", type = GuiParam.GuiParamType.TEXT)
    private String systemName;
    @GuiParam(label = "Available Orbits", type = GuiParam.GuiParamType.TEXT)
    private String orbits;
    @GuiParam(label = "X", type = GuiParam.GuiParamType.TEXT)
    private String x;
    @GuiParam(label = "Y", type = GuiParam.GuiParamType.TEXT)
    private String y;
    @OneToMany
    @GuiParam(type = GuiParam.GuiParamType.ONE_TO_MANY, label = "Planets")
    private List<Planet> planets = new ArrayList<Planet>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSystemName() {
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    public String getOrbits() {
        return orbits;
    }

    public void setOrbits(String orbits) {
        this.orbits = orbits;
    }

    public String getX() {
        return x;
    }

    public void setX(String x) {
        this.x = x;
    }

    public String getY() {
        return y;
    }

    public void setY(String y) {
        this.y = y;
    }

    public List<Planet> getPlanets() {
        return planets;
    }

    public void setPlanets(List<Planet> planets) {
        this.planets = planets;
    }
    
    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StarSystem)) {
            return false;
        }
        StarSystem other = (StarSystem) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return systemName + " ["+x+":"+y+"]";
    }
    
}
